package com.bishe.bishe.dao.mapper;

import com.bishe.bishe.pojo.Types;
import com.bishe.bishe.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
@Mapper
public interface TypesMapper {
    @Select("select * from type where type_state=1")
    List <Types> findall();

    @Insert("insert into type(type_id,type_name,type_state) value(null,#{typeName},1)")
    int insert(@Param("typeName") String typeName);

    @Update("update type set type_state=#{typeState} where type_id=#{typeId}")
    int delete(@Param("typeId") int typeId,@Param("typeState") int typeState);

    @Update("update type set type_name=#{types.typeName}where type_id=#{types.typeId}")
    int update(@Param("types") Types types);

    @Select("select * from type where type_id = #{typeId} and type_state=1")
    Types findTypes(@Param("typeId") int typeId);

    @Select("select * from type where type_name = #{typeName}")
    Types findByTypes(@Param("typeName") String typeName);

    @Select("select * from type where type_name like '%${typeName}%'")
    List<Types> findByTypesList(@Param("typeName") String typeName);
}
